<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType = "text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@ include file="/common/init.jsp"%>
<html>
<head>
<title>澳斯浪廷会员平台</title>
<link href="<c:url value='/resources/css/css.css'/>" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="<c:url value='/resources/js/jquery-1.7.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/js/validate.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/js/mask.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/js/ajaxFormSubmit.js'/>" ></script>
<script type="text/javascript">
function doComplain(){
	$.ajaxSetup({cache:false});
	var checkFlg = true;
	checkFlg = checkFlg && validateEmpty_jquery("投诉", "content");
	if ( !checkFlg ) return false;
    if (checkFlg) {
    	//var data = $("#othermember").formSerialize();
    	//document.forms[0].action = "${ctx}/savemail.action";
        //document.forms[0].submit();
        $(document).mask("系统处理中，请稍后......");
        //var data = $("#complain").serialize();
        var formId = $("#complain");
        $.ajaxFormSubmit({
    		form:formId,	
    		url: '${ctx}/docomplain.action',
    		type:'post',
    		dataType:'html',
    		uploadFiles:true,
    		secureuri:false,
    		success:function (data,status){
    			alert(data);
	    		window.location.href ="${ctx}/epmore.action";  //重新载入页面
    			if(data.msgCode=='1'){
    				//alert(data.docId);
    				//$("#${navflag}_info_id").val(data.docId);
    			}
    		},
    		error:function (data, status, e){
    			alert("提交失败,请联系管理员!");
    		}
    	});
        /* jQuery.ajax({
			url: "${ctx}/docomplain.action",
			type: "post",
			dataType:"html",
			data:data,
			async:false,
			success: function(jsondata){
				alert(jsondata);
				window.location.href = "${ctx}/epmore.action";
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) {
		    }
		}); */
    }
}

//删除附件数据
function deleteAtt(id){


    jQuery.ajax({
		url: "${ctx}/deleteAtt.action",
		type: "post",
		dataType:"html",
		data: "id="+id,
	    async:false,  // 设置同步方式
	    cache:false,
		success: function(jsondata){
			alert(jsondata);
			//self.location.href = "${ctx}/admin/eplist.action";
			$("#attdiv").html("<input type='file' name='file' size='40'/>");
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) {
	    }
	});
}
</script>
</head>
<body leftmargin="0">
<div class="main">
<div class="width_l"><iframe src="menu.action" frameborder="0" width="250" height="100%" class="menu"></iframe></div>
    <div class="right">
    <div class="width_r">
        <div class="menu_r">
            <ul>
                <li><a href="index.action">首页</a></li>
                <li><a href="information.action">消息</a></li>
                <li><a href="notice.action">公告中心</a></li>
                <li><a href="news.action">新闻中心</a></li>
                <li><a href="inbox.action">收件箱</a></li>
                <li><a href="tomail.action">写邮件</a></li>
                <li><a href="sent.action">已发送</a></li> 
                <li><a href="${ctx}/exit.action">安全退出</a></li> 
            </ul>
        </div>
        <div class="news_top"><img src="<c:url value='/resources/images/top.jpg'/>" /></div>
        <form id="complain" name="complain" method="post" enctype="multipart/form-data">
        	<input type="hidden" name="epComplain.epId" id="epId" value="${ep.id}"/>
        	<input type="hidden" name="epComplain.id" value="${epComplain.id}"/>
        <div class="news">
            <h4>EP交易投诉</h4>
            <br/>
            <br/>
          <table width="550" border="0" cellspacing="0" cellpadding="0" style="color:#676767; margin-left:150px;">
			  <tr height="40px;">
			  	<td width="15%" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;卖方：</td>
			  	<td width="85%">${ep.userId}</td>
			  </tr>
			  <tr height="40px;">
			  	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;买方：</td>
			  	<td>${ep.relationId}</td>
			  </tr>
			  <c:if test="${empty epComplain.id}"><!-- 没有投诉 -->
			  	<tr height="40px;">
				    <td valign="top">投诉内容：</td>
				    <td>
				      <textarea name="epComplain.content" id="content" class="text_1" cols="50" rows="8">${epComplain.content}</textarea></td>
				  </tr>
				  <tr height="40px;">
				    <td>上传凭证：</td>
				    <td>
				      <input type="file" name="file" size="40"/>
				  </tr>
			  </c:if>
			  <c:if test="${epComplain.handle eq '1'}"><!-- 投诉了，没有处理呢 -->
			  	<tr height="40px;">
				    <td valign="top">投诉内容：</td>
				    <td>
				      <textarea name="epComplain.content" id="content" class="text_1" cols="50" rows="8">${epComplain.content}</textarea></td>
				  </tr>
				  <tr height="40px;">
				    <td>上传凭证：</td>
				    <td id="attdiv">
				    <c:if test="${epComplain.attPath ne ''}">
					    <a href="${ctx}/download.action?inputPath=${epComplain.attPath}&downloadFileName=${epComplain.attName}&_isExternal=true">${epComplain.attName}</a>
					    <a href="javascript:deleteAtt('${epComplain.id}');">删除</a> 
				    </c:if>
				     <c:if test="${epComplain.attPath eq ''}">
				     	<input type="file" name="file" size="40"/>
				     </c:if> 
				    </td>
				  </tr>
			  </c:if>
			  <c:if test="${epComplain.handle eq '0'}"><!-- 已经处理 -->
			  	<tr height="40px;">
				    <td valign="top">投诉内容：</td>
				    <td>
				      <textarea name="epComplain.content" id="content" class="text_1" cols="50" rows="8" readonly>${epComplain.content}</textarea></td>
				  </tr>
				  <tr height="40px;">
				    <td>上传凭证：</td>
				    <td>
				      <a href="${ctx}/download.action?inputPath=${epComplain.attPath}&downloadFileName=${epComplain.attName}&_isExternal=true">${epComplain.attName}</a>
				  </tr>
				  <tr>
				  	<td>处理结果</td>
				  	<td>
				  		<textarea name="epComplain.content" id="content" class="text_1" cols="50" rows="8" readonly>${epComplain.result}</textarea>
				  	</td>
				  </tr>
			  </c:if>
		  </table>
          <div class="tijiao"><img src="<c:url value='/resources/images/tijiao.jpg'/>" onclick="doComplain();"/></div>
        </div>
        </form>
        <div class="news_down"><img src="<c:url value='/resources/images/down.jpg'/>" /></div>
    </div>
    </div>
</div>

</body>
</html>